<?php
/**
 * @author GunFox <ceason@live.cn>
 */
class GoodsTypeControl extends AuthControl{
	public function index(){
		$Model=K('GoodsType');
		$Data=$Model->all();
		$this->assign('data',$Data);
		$this->display();
	}
	public function add(){
		if(IS_POST){
			$Model=K('GoodsType');
			if($Model->addGoodsType($_POST)){
				$this->success('添加成功..',U('index'));
			}else{
				$this->error($Model->error);
			}
		}else{
			$this->display();
		}
	}
	public function del(){
		$Model=K('GoodsType');
		if($Model->delGoodsType($_GET['id'])){
				$this->success('删除成功..',U('index'));
			}else{
				$this->error($Model->error);
			}
	}
	public function edit(){
		if(IS_POST){
			$Model=K('GoodsType');
			if($Model->editGoodsType($_POST)){
				$this->success('修改成功..',U('index'));
			}else{
				$this->error($Model->error);
			}
		}else{
			$this->assign('name',$_GET['name']);
			$this->assign('id',$_GET['id']);
			$this->display();
		}
	}
}
